package io.finer.erp.jeecg.bas.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import io.finer.erp.jeecg.bas.dto.BasCustomerAddressDTO;
import io.finer.erp.jeecg.bas.entity.BasCustomerAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 客户地址表
 * @Author: jeecg-boot
 * @Date:   2020-10-09
 * @Version: V1.0
 */
public interface BasCustomerAddressMapper extends BaseMapper<BasCustomerAddress> {


    /**
     * 根据名称查询客户信息
     * @param name
     * @return
     */
    List<BasCustomerAddress> likeAddressByName(@Param("name") String name);

    @Select("select * from bas_customer_address where customer_Id=#{customerId}")
    List<BasCustomerAddress> getAddressBycustomerId(@Param("customerId")String customerId);


    @Select("select bc.name as customerName,bc.id as customer_id,bca.phone_no,bca.address from bas_customer as bc LEFT JOIN bas_customer_address as bca ON bc.id = bca.customer_id")
    List<BasCustomerAddressDTO> getAddressByCustomerAll();

}
